/**
* Created by wl
* 基金储备库-投资案例信息
*/
<template>
    <div class="ca-p-20">
        <div v-if="!showEdit">
            <div class="ca-title">
                <el-button type="text" class="ca-edit-btn el-icon-edit ca-right" @click="showEdit = true" :disabled="!isAuthEditPre" v-if="$route.name.includes('pre-investment-funds')">编辑</el-button>
                <el-button type="text" class="ca-edit-btn el-icon-edit ca-right" @click="showEdit = true" :disabled="!isAuthEdit" v-else>编辑</el-button>
            </div>
            <el-table
                :data='itemInfo.fundData'
                class="ca-table table_p_01 el-wid-100">
                <el-table-column
                    label="项目名称"
                    prop="itemId"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.itemId" placement="top" v-if="scope.row.itemId">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.itemId}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    label="公司名称"
                    prop="company"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.company" placement="top" v-if="scope.row.company">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.company}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="industry"
                    label="行业"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.industry" placement="top" v-if="scope.row.industry">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.industry}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investMoney"
                    label="投资金额</br>（万元）"
                    :render-header="renderTitle"
                    align="center"
                    width='100px'>
                </el-table-column>
                <el-table-column
                    prop="investTime"
                    label="投资时间"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.investTime" placement="top" v-if="scope.row.investTime">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.investTime}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investRound"
                    label="投资轮次"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.investRound" placement="top" v-if="scope.row.investRound">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.investRound}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="collarVote"
                    label="是否领投"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.collarVote" placement="top" v-if="scope.row.collarVote">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.collarVote}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="exitTime"
                    label="退出时间"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.exitTime" placement="top" v-if="scope.row.exitTime">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.exitTime}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="exitMode"
                    label="退出方式"
                    align="center"
                    width='100px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.exitMode" placement="top" v-if="scope.row.exitMode">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.exitMode}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="delegate"
                    label="是否委派董事监事"
                    align="center"
                    width="150px">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.delegate" placement="top" v-if="scope.row.delegate">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.delegate}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="holding"
                    label="初始持股比例"
                    width="120px">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.holding" placement="top" v-if="scope.row.holding">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.holding}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="exitMoney"
                    label="退出金额</br>（万元）"
                    :render-header="renderTitle"
                    align="center">
                </el-table-column>
                <el-table-column
                    prop="holdValue"
                    label="目前持有价值"
                    align="center"
                    width='120px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.holdValue" placement="top" v-if="scope.row.holdValue">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.holdValue}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="irr"
                    label="IRR"
                    align="center">
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.irr" placement="top" v-if="scope.row.irr">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.irr}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="participants"
                    label="主要参与人员"
                    align="center"
                    width='120px'>
                    <template slot-scope="scope">
                        <el-tooltip effect="dark" :content="scope.row.participants" placement="top" v-if="scope.row.participants">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.participants}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="remarks"
                    label="备注"
                    align="center"
                    width="200px">
                    <template slot-scope="scope">
                        <el-tooltip class="item" effect="dark" :content="scope.row.remarks" placement="top" v-if="scope.row.remarks">
                            <el-button type="text" class="ca-notes ca-text-over-flow-ellipsis">{{scope.row.remarks}}</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <csFundInfo v-else @close="showEdit = false" @update="update"></csFundInfo>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import { addRemind, isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
                showEdit: false,
                isAuthEdit: isNoAuth('基金储备库-基金详情-编辑'),
                isAuthEditPre: isNoAuth('拟投资基金-基金详情-编辑'),
                itemInfo: {
                    fundData: [],
                },
            }
        },
        created() {
        },
        mounted() {
            this.getInfo()
        },
        props: {

        },
        watch: {
        },
        methods: {
            async update() {
                this.showEdit = false
                await this.getInfo()
                // 添加小红点
                await addRemind({
                    dataId: this.$route.params.itemId, // 业务id
                    dataTab: 0, // tab页顺序 head 也为0 新建为'-1'
                    dataType: 4, // 1拟投资项目,2已投资项目,3母基金,4拟设立基金,5已设立基金,6客户,7潜在项目
                });
                // 根据第三方组件来调用 父组件中定义的方法 重新获取小红点
                this.$root.Dot.$emit('getDotList');
                // 添加小红点 end
            },
            getInfo() {
                apiHttp(api.CHECK_CASEINFO, {id: this.$route.params.itemId}).then(ret=> {
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.itemInfo.fundData = ret.data
                    }
                })
            },
        },
        components: {
            'csFundInfo': require('./edit'),//基金信息edit页
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.ca-right {
    float: right;
}
.ca-table th {
    line-height: 20px;
}
.ca-notes {
    color: #666;
}
</style>